package com.hankol.winecellar.adapter

import android.widget.TextView
import com.baselibrary.extension.setMallPriceTTF
import com.baselibrary.utils.GlideUtils
import com.baselibrary.view.RoundCornerImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.hankol.winecellar.R
import com.hankol.winecellar.bean.GoodsAfterSaleListBean
import com.baselibrary.utils.AmountUtil
import com.baselibrary.utils.OptionUtils

//二期-售后列表
class GoodsAfterSalesAdapter : BaseQuickAdapter<GoodsAfterSaleListBean, BaseViewHolder>(R.layout.item_goods_after_sales) {
    override fun convert(helper: BaseViewHolder, item: GoodsAfterSaleListBean) {
        val ivAfterSalesCover = helper.getView<RoundCornerImageView>(R.id.iv_after_sales_cover)
        helper.setText(R.id.tv_after_sales_order_number, "售后服务单：${item.afterSaleCode}")
                .setText(R.id.tv_after_sales_order_state, OptionUtils. getAfterSalesState(item.afterSaleStatus))
                .setText(R.id.iv_after_sales_title, item.products[0].spuName)
                .setText(R.id.tv_after_sales_norms, OptionUtils.getNormsStr(item.products[0].specList))
                .setText(R.id.tv_after_sales_quantity, "申请数量：${item.products[0].num}")
                .setText(R.id.tv_price, AmountUtil.changeF2YKeepTwo("${item.products[0].afterSaleRequestPrice}"))
        helper.getView<TextView>(R.id.tv_price).setMallPriceTTF(mContext)
        helper.getView<TextView>(R.id.tv_unit).setMallPriceTTF(mContext)
        GlideUtils.loadImg_101(mContext.applicationContext, item.products[0].skuCover, ivAfterSalesCover)
    }
}